﻿#-*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name:        tabulation表格，listing列表
# Purpose:
# Author:      SUMMVING
# Created:     12/08/2013
# Copyright:   (c) SUMMVING 2013
# Licence:     GPLv3
#-------------------------------------------------------------------------------

listsum=['sum',22,'male']           #建立listsum列表，注意是用中括号[]

t = ('sum',22,'male')               #元组，小括号()

print (type (listsum))              #查看listsum的数据类型,输出：<type 'list'>
print '----'
print 'listsum=',listsum            #输出：listsum= ['sum', 22, 'male']
print 't=',t
listsum[0] = 'summving'             #将列表的第1个元素sum修改为summving
print 'sum to the summving =',listsum
print '----'

"""列表增加元素"""
listsum.append("tel")               #.append():列表元素增加函数
listsum.append('137269')            #增加一个元素137269
print 'add tel and 137,listsum =',listsum
                                    #输出：add tel and 137,listsum = ['summving', 22, 'male', 'tel', '137269']
listsum.remove(listsum[3])          #去除tel，单引号' '和 " "没有什么区别
                                    #listsum.remove(listsum['tel'])这样有语法错误,不能这样使用
print 'after remove tel,listsum =',listsum

del(listsum[1])                     #以函数del去除第二个元素22
                                    #del(listsum['tel'])这样有语法错误
print 'after delete 22,listsum =',listsum
                                    #输出：after delete 22,listsum = ['summving', 'male', '137269']

